package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.inspectionwork;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.inspectionwork.InspectionworkService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * 检查工作下发控制器
 */
@Action
@RequestMapping(value="inspectionwork/inspectionwork")
public class InspectionworkController extends BaseController {
    @Resource
    public InspectionworkService inspectionworkService;

    /**
     * 检查工作下发列表查询
     * @param
     * @return
     */
    @At(value = "listInspectionworkListPage", method = RequestMethod.GET, param = { "page","limit" })
    public RespEntity listInspectionworkListPage(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionworkService.listInspectionworkListPage(jsonParam);
    }

    /**
     * 检查落实任务列表：单位用
     * @param
     * @return
     */
    @At(value = "workableList", method = RequestMethod.GET)
    public RespEntity workableList(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionworkService.workableList(jsonParam);
    }

    /**
     * 检查工作下发列表新建
     * @param  title:任务标题; type:检查类型:数据来源于字典表中的检查类型;des:任务描述;starttime:开始时间;files:附件信息：对象数组，对象中包括字段：附件名称 fileName 附件路径 filePath
     *            units:接收单位信息：为一个逗号分隔的字符串，分隔的单位id；
     * @return
     */
    @At(value = "add", method = RequestMethod.POST, param = { "type"})
    public RespEntity add(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionworkService.add(jsonParam);
    }

    /**
     * 检查工作下发删除
     * @param jsonParam
     * @return
     */
    @At(value = "delete", method = RequestMethod.POST, param = {"id"})
    public RespEntity delete(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionworkService.delete(jsonParam);
    }

    /**
     * 检查工作下发详情
     * @param
     * @return
     */
    @At(value = "getById", method = RequestMethod.GET, param = { "id" })
    public RespEntity getById(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionworkService.getById(jsonParam);
    }

    /**
     * 单位的落实情况列表
     * @param  starttime:开始时间(筛选落实时间workabletime（筛选包括传过来的时间）)
     *            endtime
     *            isworkable:检查任务下发时用：是否落实：0 未落实 1 已落实
     *            name:单位名称：模糊查询
     *            fireRating:消防等级: 对应字典表：消防安全重点单位、消防安全一般单位、九小场所、 其它
     *            id:检查工作下发的id
     * @return
     */
    @At(value = "workableBusinessListPage", method = RequestMethod.GET, param = { "page","limit","id" })
    public RespEntity workableBusinessListPage(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionworkService.workableBusinessListPage(jsonParam);
    }

    /**
     * 单位落实
     * @param   id:检查工作下发的id
     * @return
     */
    @At(value = "workable", method = RequestMethod.POST, param = { "id" })
    public RespEntity workable(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionworkService.workable(jsonParam);
    }

    /**
     * 字典组查询
     * @param  groupname	字典组
     * @return
     */
    @At(value = "dictList", method = RequestMethod.GET, param = { "groupname" })
    public RespEntity dictList(@RequestBody(required = false) JSONObject jsonParam) {
        return inspectionworkService.dictList(jsonParam);
    }






   
}